package com.faryangsh;

import com.faryangsh.bean.one.UserOne;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication
@Slf4j
@EntityScan(basePackages = "com.faryangsh.bean")
@EnableAutoConfiguration()
public class JpatestApplication {

	public static void main(String[] args) throws UnknownHostException {
		Environment env = SpringApplication.run(JpatestApplication.class, args).getEnvironment();
		String port = env.getProperty("server.port", "8080");
		log.info(
				"Access URLs:\n----------------------------------------------------------\n\t"
						+ "Swagger-UI: http://127.0.0.1:{}/swagger-ui.html\n\t"
						+ "Local: \t\thttp://127.0.0.1:{}\n\t"
						+ "External: \thttp://{}:{}\n----------------------------------------------------------",
				port, InetAddress.getLocalHost().getHostAddress(), port
		);
	}

}
